/**
 * JAVACC DEMO 1.0
 * @copy right dwusoft company All rights reserved. 
 * @Package com.apache.info.service.plugins  
 */
package com.apache.info.service.plugins;

import java.util.Map;

import com.apache.api.vo.ParamsVo;
import com.apache.cache.util.Validator;
import com.apache.info.entity.PubInfoStatistics;
import com.apache.info.manager.InfoReleaseManager;
import com.apache.info.manager.PubInfoStatisticsManager;

/**
 * description:  动态删除数据
 * @author Hou Dayu 创建时间：2015-8-29  
 * @Copyright(c)2014:北京--软件技术有限公司
 */
public class DeleteDynamicInfoPluginImpl extends AbstractInfoReleasePlugin {

	private InfoReleaseManager InfoReleaseManager;
	private PubInfoStatisticsManager pubInfoStatisticsManager;

	/**
	 * TODO 简单描述该方法的实现功能（可选）.  
	 * @see com.apache.info.service.plugins.AbstractInfoReleasePlugin#doInvoke(com.apache.api.vo.ParamsVo)  
	 */
	protected Object doInvoke(ParamsVo vo) {
		boolean mark = InfoReleaseManager.deleteInfo(vo);
		if (mark && "true".equals(String.valueOf(vo.getParams("flagInfoStatistics")))) {//删除统信息
			Map map = vo.getParams();
			ParamsVo pvo = new ParamsVo();
			if (Validator.isNotNull(String.valueOf(map.get("infoId")))) {
				PubInfoStatistics ps = new PubInfoStatistics();
				ps.setObjId(String.valueOf(map.get("infoId")));
				ps.setSortId(String.valueOf(vo.getParams("sortCode")));
				pvo.setObj(ps);
				pubInfoStatisticsManager.deleteInfo(pvo);
			}
		}
		return mark;
	}

	public void setInfoReleaseManager(InfoReleaseManager infoReleaseManager) {
		InfoReleaseManager = infoReleaseManager;
	}

	public void setPubInfoStatisticsManager(PubInfoStatisticsManager pubInfoStatisticsManager) {
		this.pubInfoStatisticsManager = pubInfoStatisticsManager;
	}

}
